﻿using netCoreStudy.Dto.User;
using netCoreStudy.Entities;

namespace netCoreStudy.Profile
{
	public class RoleMenuProfile : AutoMapper.Profile
	{
		public RoleMenuProfile()
		{
			CreateMap<RoleMenu, RoleMenuDto>();
			CreateMap<RoleMenuDto, RoleMenu>();
			CreateMap<AddRoleMenuDto, RoleMenuDto>();
			CreateMap<UpdateRoleMenuDto, RoleMenuDto>();
			CreateMap<RoleMenu, MenuDtoSm>()
				.ForMember(d => d.Id, o => o.MapFrom(s => s.Menu.Id))
				.ForMember(d => d.Name, o => o.MapFrom(s => s.Menu.Name))
				.ForMember(d => d.Path, o => o.MapFrom(s => s.Menu.Path))
				.ForMember(d => d.Icon, o => o.MapFrom(s => s.Menu.Icon))
				.ForMember(d => d.PId, o => o.MapFrom(s => s.Menu.PId))
				;
		}
	}
}